﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ObjRec
{
    class Vector
    {
        private double[] values;

        public Vector(double[] values)
        {
            this.values = values;
        }

        /// <summary>
        /// Return vector's length
        /// </summary>
        public double Length
        {
            get
            {
                double length = values.Sum(x => x * x);
                return Math.Sqrt(length);
            }
        }

        /// <summary>
        /// Return normalized vector, doesn't affect values
        /// </summary>
        public double[] Normalized
        {
            get
            {
                double[] values = Array.ConvertAll(this.values, x => x / Length);
                return values;
            }
        }
    }
}
